- name: make the app be real
  hosts: os_control:os_control_stg
  user: root
  gather_facts: False

  vars_files:
    - /srv/web/infra/ansible/vars/global.yml
    - "/srv/private/ansible/vars.yml"
    - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - role: openshift/project
    app: fedora-ostree-pruner
    description: Prunes OSTree repositories based on policy
    appowners:
    - dustymabe
    - jlebon
    - kevin

  - role: openshift/object
    app: fedora-ostree-pruner
    template: imagestream.yml
    objectname: imagestream.yml

  - role: openshift/object
    app: fedora-ostree-pruner
    template: buildconfig.yml
    objectname: buildconfig.yml

  - role: openshift/start-build
    app: fedora-ostree-pruner
    buildname: fedora-ostree-pruner-build
    objectname: fedora-ostree-pruner-build

  - role: openshift/object
    app: fedora-ostree-pruner
    template: deploymentconfig.yml
    objectname: deploymentconfig.yml

  - role: openshift/object
    app: fedora-ostree-pruner
    template: pvc.yml
    objectname: pvc.yml

###############################################
# actions to delete the project from OpenShift
###############################################
# to run: sudo rbac-playbook -l os_control_stg -t delete openshift-apps/fedora-ostree-pruner.yml
  - role: openshift/object-delete
    app: fedora-ostree-pruner
    objecttype: project
    objectname: fedora-ostree-pruner
    tags: [ never, delete ]
